home *** CD-ROM | disk | FTP | other *** search
- uses TypInfo;
-
- function WhatField(activeCtrl: TWinControl): string;
- var
- propInfo: PPropInfo;
- fieldName, nameOfTable: string;
- begin
- propInfo := TypInfo.GetPropInfo(activeCtrl. ClassInfo, 'DataField');
- if propInfo <> nil then begin
- fieldName := GetStrProp(activeCtrl, propInfo);
- propInfo := TypInfo.GetPropInfo(activeCtrl.ClassInfo, 'DataSource');
- if propInfo <> nil then
- {note can not return nil since we already checked control has DataField}
- nameOfTable := (TDataSource(GetOrdProp(activeCtrl,
- propInfo)).DataSet as TTable).TableName;
- Result := Format('%s in %s', [UpperCase(fieldName),
- UpperCase(nameOfTable)]);
- end else Result := '';
- end;
-